Cytosim  PI
Cytoskeleton Simulator
Solid Class Reference

Detailed Description

This is a PointSet behaving like a undeformable cloud of points. Each point can have its own radius and together they define the viscous drag of the Solid in the medium.

Geometry:

The ensemble can rotate and translate like a rigid body under external forces, but the relative configuration of the points in space is fixed: the distance between any two points is constant.

A snapshot of the current geometry is saved in soShape[] by fixShape(). This configuration is reapplied to the current points by reshape(). reshape() however find the best isometric transformation of soShape[] into the current configuration to maintain the current position and the current orientation of the object.

Viscous Drag:

The distance between the points, and their radii define a total drag coefficient according to Stokes's law applied to individual spheres. Points that have a radius = 0 do not induce viscous drag. The hydrodynamic interactions between the beads in the ensemble, and more advanced hydrodynamic effects are neglected. The drag coefficent for translation is simply the sum of Stoke's law, for all points that have a radius > 0. The rotational drag coefficient involves the second momentum of the configuration.

Related classes:

Solid is an extension of Bead. A Solid with only one point is equivalent to a Bead, but slower to simulate.

Inheritance diagram for Solid:
PointSet Mecable Object Buddy Node Inventoried Movable

Public Member Functions

virtual unsigned int allocatePoints (unsigned int size)
 allocate memory to hold 'size' points More...
 
void deallocatePoints ()
 free all memory allocated by allocatePoints()
 
void build (Glossary &)
 initialize points More...
 
 Solid (SolidProp const *)
 create following the specifications in the SolidProp
 
virtual ~Solid ()
 destructor
 
void setDragCoefficient ()
 sets the mobility More...
 
real dragCoefficient () const
 the total drag-coefficient of object (force = drag * speed)
 
void prepareMecable ()
 prepare for Meca More...
 
void makeProjection ()
 prepare for constrained projection
 
void setSpeedsFromForces (const real *X, real *Y, real, bool) const
 calculates the speed of points in Y, for the forces given in X
 
real addBrownianForces (real *rhs, real sc) const
 add contribution of Brownian forces
 
void step ()
 monte-carlo step
 
void fixShape ()
 set the reference shape as a copy of the current one More...
 
void scaleShape (real, real, real)
 scale the reference shape More...
 
void rescale ()
 scale current shape to match the reference set in fixShape() More...
 
void reshape ()
 restore the reference shape in the place and orientation of the current one
 
void getPoints (const real *x)
 set position More...
 
void setInteractions (Meca &) const
 add the interactions due to confinement
 
real radius (const unsigned int pp) const
 the radius of the sphere attached at point pp
 
void radius (unsigned int pp, real radius)
 set the radius of the sphere which is attached at point index pos
 
real sumRadius ()
 the sum of the radiuses of all spheres
 
Vector centroid ()
 mean of all spheres weighted with their drag coefficients (or equivalently radius)
 
unsigned int addPointWithDrag (Vector const &w, real radius)
 add a new point with a sphere
 
Solidnext () const
 a static_cast<> of Node::next()
 
Solidprev () const
 a static_cast<> of Node::prev()
 
Tag tag () const
 return unique character identifying the class
 
const Propertyproperty () const
 return Object Property
 
void read (InputWrapper &, Simul &)
 read from file
 
void write (OutputWrapper &) const
 write to file
 
- Public Member Functions inherited from PointSet
 PointSet ()
 Constructor.
 
 PointSet (const PointSet &)
 Copy constructor.
 
PointSetoperator= (const PointSet &)
 Assignement operator.
 
virtual ~PointSet ()
 Destructor.
 
unsigned int nbPoints () const
 Number of points.
 
unsigned int lastPoint () const
 Index of the last point = nbPoints - 1.
 
unsigned int nbSegments () const
 Number of segments = nbPoints - 1.
 
unsigned int lastSegment () const
 Index of the last segment = nbPoints - 2.
 
Vector posP (const unsigned p) const
 Position of point 'p' of the object.
 
real const * addr () const
 Address of point p.
 
real const * addrPoint (const unsigned p) const
 Address of point p.
 
void setPoint (unsigned p, Vector const &w)
 Set position of point p to w.
 
void nbPoints (const unsigned n)
 Set the number of points in the array.
 
unsigned int addPoint (Vector const &w)
 Add a point, returning the array index that was used.
 
void removePoint (unsigned int p)
 Remove a point from the array psPos, returns number of points remaining.
 
virtual void truncateM (unsigned int p)
 Remove all points with indices [ 0, p-1 ], keep [ p, nbPoints() ]. More...
 
virtual void truncateP (unsigned int p)
 Keep points [ 0, p ], remove other points. More...
 
void clearPoints ()
 Remove all points.
 
void resetPoints ()
 Set all coordinates to zero (nicer for debug/testing)
 
void addNoise (real amount)
 Add random noise uniformly to all coordinate (used for testing purposes)
 
virtual void putPoints (real *) const
 copy current coordinates to argument
 
virtual void getForces (const real *ptr)
 replace current forces by the ones provided
 
Vector netForceP (const unsigned p) const
 Force on point p calculate by Brownian dynamics.
 
void movePoint (const unsigned int p, Vector const &w)
 Shift point at index p by vector w.
 
Vector diffPoints (const unsigned p) const
 Difference of two points = Q - P = vector PQ.
 
Vector diffPoints (const unsigned int p, const unsigned int q) const
 Difference of two points = Q - P = vector PQ.
 
Vector interpolatePoints (const unsigned int p, const unsigned int q, const real a) const
 Calculate intermediate position = P + a ( Q - P )
 
void calculateMomentum (real[], bool divide=false)
 calculate first momentum of point coordinates More...
 
void calculateMomentum (real[], real[], bool divide=false)
 calculate first and second momentum of point coordinates More...
 
virtual Vector position () const
 Position of center of gravity. More...
 
virtual bool translatable () const
 true if object accepts translations
 
virtual void translate (Vector const &)
 Translate object (moves all the points by w)
 
virtual bool rotatable () const
 true if object accepts translations
 
virtual void rotate (Rotation const &)
 Rotate object by given rotation.
 
virtual void foldPosition (const Modulo *)
 Modulo around the first point.
 
virtual void foldPositionG (const Modulo *)
 Call modulo around the center of gravity.
 
- Public Member Functions inherited from Mecable
 Mecable ()
 The constructor resets the pointers.
 
virtual ~Mecable ()
 Destructor de-allocates memory.
 
virtual Vector posP (unsigned int P) const =0
 return position of point P
 
virtual void putPoints (real[]) const =0
 copy current coordinates to provided array
 
virtual void getPoints (const real[])=0
 replace current coordinates of points by values from the provided array
 
virtual Vector netForceP (unsigned int p) const =0
 return Force on point p calculated at previous step by Brownian dynamics
 
virtual void getForces (const real[])=0
 replace current forces by the ones provided
 
void matIndex (Matrix::index_type index)
 Store the index where coordinates are located in Meca.
 
Matrix::index_type matIndex () const
 Index in mB of the first point. the index in the vectors is DIM*matIndex() More...
 
bool useBlock () const
 Tell Meca to use preconditionning on this object or not.
 
void useBlock (bool b)
 change preconditionning flag
 
realallocateBlock (unsigned)
 Allocate a block of the requested size.
 
realblock () const
 return allocated block
 
virtual void addRigidity (const real *X, real *Y) const
 Add rigidity terms Y <- Y + Rigidity * X. More...
 
virtual void addRigidityMatUp (Matrix &mB, int offset) const
 Add rigidity matrix elements (which should be symmetric) to provided matrix. More...
 
virtual void makeProjectionDiff (const real *forces)
 set the terms obtained from the linearization of the Projection operator, from the given forces More...
 
virtual void addProjectionDiff (const real *X, real *Y) const
 add terms from projection correction terms: Y <- Y + P' * X; More...
 
- Public Member Functions inherited from Object
 Object ()
 constructor
 
std::string reference () const
 concatenation of [ tag(), property()->index(), number() ] in plain ascii More...
 
void writeReference (OutputWrapper &) const
 write a reference that identifies the Object uniquely More...
 
void writeReference (OutputWrapper &, Tag tag) const
 write a reference, but using the provided Tag More...
 
int mark () const
 birth mark value
 
void mark (int m)
 set birth mark
 
int fleck () const
 fleck value (not stored in trajectory files)
 
void fleck (int f) const
 set fleck (the value is not stored in trajectory files)
 
Objectnext () const
 extends Node::next(), with a cast to preserve type
 
Objectprev () const
 extends Node::prev(), with a cast to preserve type
 
- Public Member Functions inherited from Node
 Node ()
 constructor set as unlinked
 
virtual ~Node ()
 destructor More...
 
bool linked () const
 true if Node is linked
 
Nodenext () const
 the next Node in the list, or zero if this is last
 
Nodeprev () const
 the previous Node in the list, or zero if this is first
 
NodeListlist () const
 the list where the object is linked, or zero
 
ObjectSetobjset () const
 return associated ObjectSet
 
- Public Member Functions inherited from Inventoried
 Inventoried ()
 initialize (name=0)
 
 ~Inventoried ()
 destructor
 
void number (Number n)
 change the serial number
 
Number number () const
 serial number : a integer identifier, unique within each class
 
- Public Member Functions inherited from Movable
 Movable ()
 constructor
 
virtual ~Movable ()
 destructor
 
virtual void setPosition (Vector const &)
 move object to specified position More...
 
virtual void rotateP (Rotation const &)
 rotate the object around its current position More...
 
- Public Member Functions inherited from Buddy
virtual ~Buddy ()
 upon destruction, goodbye is called for all buddies
 
void hello (Buddy *b)
 will make this and b mutual buddies
 
virtual void goodbye (Buddy *)
 this is called everytime a known buddy is destroyed
 
Buddybuddy (unsigned int ix) const
 return buddy at index ix
 
void buddy (Buddy *b, unsigned int ix)
 replace the buddy that may have been at index ix
 

Public Attributes

SolidProp const * prop
 Property.
 

Static Public Attributes

static const Tag TAG = 'd'
 a unique character identifying the class
 
- Static Public Attributes inherited from Object
static const Tag TAG = 'v'
 Object::TAG = 'v' represents the 'void' pointer.
 

Additional Inherited Members

- Static Public Member Functions inherited from PointSet
static Vector diffPoints (const real *src, const unsigned p)
 Difference of two points = P+1 - P.
 
- Static Public Member Functions inherited from Object
static std::string strReference (char, int, Number, int)
 build a string reference by concatenating (tag, property_index, number, mark) More...
 
static void readReference (InputWrapper &, int &, Number &, int &, char pretag)
 read a reference (property_index, number, mark) from input More...
 
static void writeNullReference (OutputWrapper &)
 write a reference that does not refer to any Object
 
- Static Public Member Functions inherited from Movable
static Vector readPrimitive (std::istream &, const Space *)
 read a position specified with primitives, such as 'circle 5', etc. More...
 
static Vector readPosition (std::istream &, const Space *)
 read a position in space More...
 
static Vector readDirection (std::istream &, const Vector &, const Space *)
 read an orientation, and return a normalized vector More...
 
static Rotation readRotation (std::istream &, const Vector &, const Space *)
 read a rotation specified in is, at position pos More...
 
- Protected Attributes inherited from PointSet
realpsPos
 psPos[] of size DIM*psAllocated contains DIM*psSize point-coordinates
 
real const * psFor
 psFor[] of size DIM*psAllocated contains DIM*psSize force-coordinates
 
Vector psCenter
 Center of gravity calculed in calculatePosition()
 
- Protected Attributes inherited from Node
NodenNext
 the next Node in the list
 
NodenPrev
 the previous Node in the list
 
- Protected Attributes inherited from Inventoried
Number nNumber
 object identifier, unique within the class defined by tag()
 

Member Function Documentation

unsigned int allocatePoints ( unsigned int  size)
virtual

This calls PointSet::allocatePoints(). If PointSet::allocatePoints() allocated memory, it will return the size of the new array, and in that case, the same size is allocated for other arrays.

Reimplemented from PointSet.

void build ( Glossary opt)
Todo:
Solid: 3D clustered distribution
void fixShape ( )

fixShape() copies the current shape in the array soShape[], and calculates the moment of inertia of the ensemble of points. The reference soShape[] is used by 'reshape()', and 'rescale()'.

void getPoints ( const real x)
virtual

reshapeReally() finds the best isometric transformation = rotation + translation to bring the reference (soShape[]) onto the current shape (PointSet::psPos[]), and then replaces psPos[] by the transformed soShape[]. This restores the shape of the cloud of point which is stored in soShape[], into the current position and orientation of the object. The best translation is the ones that conserves the center of gravity, The best rotation is obtained differently in 2D and 3D, and is unique.

Todo:
: store the rotation and translation calculated by reshapeReally()

getPoints() calls rescale() often and reshapeReally() occasionally, because

  • reshapeReally() corrects for all kind of numerical drift but is CPU expensive
  • rescale() corrects for 2d order numerical drift, which are dominant.

The calls for different solids are shifted by using the number() of each Solid.

Reimplemented from PointSet.

void prepareMecable ( )
virtual

setDragCoefficient() is called by fixShape(), and it is not necessary to call it here again.

Implements Mecable.

void rescale ( )

Rescale the current cloud of points around its center of gravity, to recover the same 'size' as the reference soShape[]. Size is measured as sum( ( x - g )^2 ).

void scaleShape ( real  sx,
real  sy,
real  sz 
)

The function rescale the reference shape soShape[], that was specified last time fixShape() was called. If axis==-1 (default), then all dimensions are scaled uniformly. The next call to reshape() will then apply the new reference to the current shape.

void setDragCoefficient ( )
virtual

Stokes relations: Translation: muT = 6*M_PI*viscosity*radius; muT * dx/dt = force Rotation: muR = 8*M_PI*viscosity*cub(radius) muR * d(angle)/dt = force-torque

Implements Mecable.